home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / nsis-2.46-setup.exe / Contrib / Modern UI 2 / Pages.nsh < prev   
Encoding:
Text File  |  2007-12-01  |  4.1 KB  |  161 lines

  1. /*
  2.  
  3. NSIS Modern User Interface
  4. Support code for all pages
  5.  
  6. */
  7.  
  8. ;--------------------------------
  9. ;Page initialization
  10.  
  11. !macro MUI_PAGE_INIT
  12.  
  13.   ;Include interface settings in neccesary
  14.   !insertmacro MUI_INTERFACE
  15.  
  16.   ;Define settings for installer page
  17.   !insertmacro MUI_UNSET MUI_PAGE_UNINSTALLER
  18.   !insertmacro MUI_UNSET MUI_PAGE_UNINSTALLER_PREFIX
  19.   !insertmacro MUI_UNSET MUI_PAGE_UNINSTALLER_FUNCPREFIX
  20.   
  21.   !insertmacro MUI_SET MUI_PAGE_UNINSTALLER_PREFIX ""
  22.   !insertmacro MUI_SET MUI_PAGE_UNINSTALLER_FUNCPREFIX ""
  23.  
  24.   ;Generate unique ID
  25.   !insertmacro MUI_UNSET MUI_UNIQUEID
  26.   !define MUI_UNIQUEID ${__LINE__}
  27.  
  28. !macroend
  29.  
  30. !macro MUI_UNPAGE_INIT
  31.  
  32.   ;Include interface settings
  33.   !insertmacro MUI_INTERFACE
  34.  
  35.   ;Define prefixes for uninstaller page
  36.   !insertmacro MUI_SET MUI_UNINSTALLER ""
  37.   
  38.   !insertmacro MUI_SET MUI_PAGE_UNINSTALLER ""
  39.   !insertmacro MUI_SET MUI_PAGE_UNINSTALLER_PREFIX "UN"
  40.   !insertmacro MUI_SET MUI_PAGE_UNINSTALLER_FUNCPREFIX "un."
  41.   
  42.   ;Generate unique ID
  43.   !insertmacro MUI_UNSET MUI_UNIQUEID
  44.   !define MUI_UNIQUEID ${__LINE__}  
  45.  
  46. !macroend
  47.  
  48.  
  49. ;--------------------------------
  50. ;Header text for standard MUI page
  51.  
  52. !macro MUI_HEADER_TEXT_PAGE TEXT SUBTEXT
  53.  
  54.   !ifdef MUI_PAGE_HEADER_TEXT & MUI_PAGE_HEADER_SUBTEXT
  55.     !insertmacro MUI_HEADER_TEXT "${MUI_PAGE_HEADER_TEXT}" "${MUI_PAGE_HEADER_SUBTEXT}"
  56.   !else ifdef MUI_PAGE_HEADER_TEXT
  57.     !insertmacro MUI_HEADER_TEXT "${MUI_PAGE_HEADER_TEXT}" "${SUBTEXT}"
  58.   !else ifdef MUI_PAGE_HEADER_SUBTEXT
  59.     !insertmacro MUI_HEADER_TEXT "${TEXT}" "${MUI_PAGE_HEADER_SUBTEXT}"
  60.   !else
  61.     !insertmacro MUI_HEADER_TEXT "${TEXT}" "${SUBTEXT}"
  62.   !endif
  63.  
  64.   !insertmacro MUI_UNSET MUI_PAGE_HEADER_TEXT
  65.   !insertmacro MUI_UNSET MUI_PAGE_HEADER_SUBTEXT
  66.  
  67. !macroend
  68.  
  69.  
  70. ;--------------------------------
  71. ;Header text for custom page
  72.  
  73. !macro MUI_HEADER_TEXT TEXT SUBTEXT ;Called from script
  74.  
  75.   !verbose push
  76.   !verbose ${MUI_VERBOSE}
  77.  
  78.   !ifdef MUI_HEADER_TRANSPARENT_TEXT
  79.     LockWindow on
  80.   !endif
  81.  
  82.   SendMessage $mui.Header.Text ${WM_SETTEXT} 0 "STR:${TEXT}"
  83.   SendMessage $mui.Header.SubText ${WM_SETTEXT} 0 "STR:${SUBTEXT}"
  84.  
  85.   !ifdef MUI_HEADER_TRANSPARENT_TEXT
  86.     LockWindow off
  87.   !endif
  88.  
  89.   !verbose pop
  90.  
  91. !macroend
  92.  
  93.  
  94. ;--------------------------------
  95. ;Custom page functions
  96.  
  97. !macro MUI_PAGE_FUNCTION_CUSTOM TYPE
  98.  
  99.   !ifdef MUI_PAGE_CUSTOMFUNCTION_${TYPE}
  100.     Call "${MUI_PAGE_CUSTOMFUNCTION_${TYPE}}"
  101.     !undef MUI_PAGE_CUSTOMFUNCTION_${TYPE}
  102.   !endif
  103.  
  104. !macroend
  105.  
  106.  
  107. ;--------------------------------
  108. ;Support for full window pages (like welcome/finish page)
  109.  
  110. !macro MUI_PAGE_FUNCTION_FULLWINDOW
  111.  
  112.   !ifndef MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_FULLWINDOW
  113.     !define MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_FULLWINDOW
  114.  
  115.     Function ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageLoadFullWindow
  116.     
  117.       LockWindow on
  118.       
  119.       ;The branding text needs to be hidden because the full windows page
  120.       ;overlaps with it.
  121.       ShowWindow $mui.Branding.Background ${SW_HIDE}
  122.       ShowWindow $mui.Branding.Text ${SW_HIDE}      
  123.       
  124.       ;The texts need to be hidden because otherwise they may show through
  125.       ;the page above when the Alt key is pressed.
  126.       ShowWindow $mui.Header.Text ${SW_HIDE}
  127.       ShowWindow $mui.Header.SubText ${SW_HIDE}
  128.       ShowWindow $mui.Header.Image ${SW_HIDE}
  129.  
  130.       ;Show line below full width of page
  131.       ShowWindow $mui.Line.Standard ${SW_HIDE}
  132.       ShowWindow $mui.Line.FullWindow ${SW_NORMAL}
  133.       
  134.       LockWindow off
  135.       
  136.     FunctionEnd
  137.     
  138.     Function ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageUnloadFullWindow
  139.     
  140.       ;Set everything back to normal again
  141.     
  142.       LockWindow on
  143.       
  144.       ShowWindow $mui.Branding.Background ${SW_NORMAL}
  145.       ShowWindow $mui.Branding.Text ${SW_NORMAL}
  146.       
  147.       ShowWindow $mui.Header.Text ${SW_NORMAL}
  148.       ShowWindow $mui.Header.SubText ${SW_NORMAL}
  149.       ShowWindow $mui.Header.Image ${SW_NORMAL}
  150.       
  151.       ShowWindow $mui.Line.Standard ${SW_NORMAL}
  152.       ShowWindow $mui.Line.FullWindow ${SW_HIDE}
  153.       
  154.       LockWindow off
  155.       
  156.     FunctionEnd    
  157.     
  158.   !endif
  159.  
  160. !macroend
  161.